 #pragma once

// CNListCtrl By WangJia

class AFX_EXT_CLASS CNListCtrl : public CXTListCtrl
{
	DECLARE_DYNAMIC(CNListCtrl)

public:
	CNListCtrl();
	virtual ~CNListCtrl();

protected:
	DECLARE_MESSAGE_MAP()
	afx_msg void OnCustomDraw(NMHDR*, LRESULT*);
	afx_msg void OnLvnColumnclick(NMHDR *pNMHDR, LRESULT *pResult);
	virtual bool SortList(int nCol, bool bAscending);
	void Init(void);

	bool m_bInit;
	_ConnectionPtr		m_pConn;
	CAdoRecordSet		m_pRs;
	CXTFlatHeaderCtrl	m_flatHeader;
	CFont				m_hFont;
	CString				m_szSQL;
	CString				m_szHighLightID;

public:
	virtual ULONG Bind(CString _sql);
	virtual void Refresh(void);
	virtual void SetHightLight(int _id);
	virtual void SetHightLight(CString _id);
	virtual void CleanHightLight(void);
	virtual BOOL IsItemSelected(void);
	CString GetSelItemText( int nCol = 0);
	void SetDataSource(_ConnectionPtr & _conn);	

	afx_msg void OnNcPaint();
};


